3.11.75 \(\int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx\) [1075]

Optimal. Leaf size=91 \[ \frac {(c-i d)^2 x}{4 a^2}+\frac {(c+i d) (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2} \]

[Out]

1/4*(c-I*d)^2*x/a^2+1/4*(c+I*d)*(I*c+3*d)/a^2/f/(1+I*tan(f*x+e))+1/4*I*(c+I*d)^2/f/(a+I*a*tan(f*x+e))^2

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 91, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.107, Rules used = {3621, 3607, 8} \begin {gather*} \frac {(c+i d) (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {x (c-i d)^2}{4 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x])^2,x]

[Out]

((c - I*d)^2*x)/(4*a^2) + ((c + I*d)*(I*c + 3*d))/(4*a^2*f*(1 + I*Tan[e + f*x])) + ((I/4)*(c + I*d)^2)/(f*(a +
 I*a*Tan[e + f*x])^2)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3607

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-(
b*c - a*d))*((a + b*Tan[e + f*x])^m/(2*a*f*m)), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1
), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 3621

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[(
-b)*(a*c + b*d)^2*((a + b*Tan[e + f*x])^m/(2*a^3*f*m)), x] + Dist[1/(2*a^2), Int[(a + b*Tan[e + f*x])^(m + 1)*
Simp[a*c^2 - 2*b*c*d + a*d^2 - 2*b*d^2*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a
*d, 0] && LeQ[m, -1] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx &=\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}+\frac {\int \frac {a \left (c^2-2 i c d+d^2\right )-2 i a d^2 \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{2 a^2}\\ &=\frac {(c+i d) (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}+\frac {(c-i d)^2 \int 1 \, dx}{4 a^2}\\ &=\frac {(c-i d)^2 x}{4 a^2}+\frac {(c+i d) (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 1.07, size = 134, normalized size = 1.47 \begin {gather*} -\frac {\sec ^2(e+f x) \left (4 i \left (c^2+d^2\right )+\left (c d (-2-8 i f x)+c^2 (i+4 f x)-d^2 (i+4 f x)\right ) \cos (2 (e+f x))+\left (d^2 (-1-4 i f x)+c^2 (1+4 i f x)+2 c d (i+4 f x)\right ) \sin (2 (e+f x))\right )}{16 a^2 f (-i+\tan (e+f x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x])^2,x]

[Out]

-1/16*(Sec[e + f*x]^2*((4*I)*(c^2 + d^2) + (c*d*(-2 - (8*I)*f*x) + c^2*(I + 4*f*x) - d^2*(I + 4*f*x))*Cos[2*(e
 + f*x)] + (d^2*(-1 - (4*I)*f*x) + c^2*(1 + (4*I)*f*x) + 2*c*d*(I + 4*f*x))*Sin[2*(e + f*x)]))/(a^2*f*(-I + Ta
n[e + f*x])^2)

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 123, normalized size = 1.35

method result size
derivativedivides \(\frac {\left (\frac {1}{8} i d^{2}-\frac {1}{8} i c^{2}-\frac {1}{4} c d \right ) \ln \left (\tan \left (f x +e \right )-i\right )-\frac {-c d +\frac {1}{2} i c^{2}-\frac {1}{2} i d^{2}}{2 \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {\frac {1}{2} i c d -\frac {1}{4} c^{2}-\frac {3}{4} d^{2}}{\tan \left (f x +e \right )-i}-\frac {i \left (2 i c d -c^{2}+d^{2}\right ) \ln \left (\tan \left (f x +e \right )+i\right )}{8}}{f \,a^{2}}\) \(123\)
default \(\frac {\left (\frac {1}{8} i d^{2}-\frac {1}{8} i c^{2}-\frac {1}{4} c d \right ) \ln \left (\tan \left (f x +e \right )-i\right )-\frac {-c d +\frac {1}{2} i c^{2}-\frac {1}{2} i d^{2}}{2 \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {\frac {1}{2} i c d -\frac {1}{4} c^{2}-\frac {3}{4} d^{2}}{\tan \left (f x +e \right )-i}-\frac {i \left (2 i c d -c^{2}+d^{2}\right ) \ln \left (\tan \left (f x +e \right )+i\right )}{8}}{f \,a^{2}}\) \(123\)
risch \(-\frac {i x c d}{2 a^{2}}+\frac {x \,c^{2}}{4 a^{2}}-\frac {x \,d^{2}}{4 a^{2}}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{2}}{4 a^{2} f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} d^{2}}{4 a^{2} f}-\frac {{\mathrm e}^{-4 i \left (f x +e \right )} c d}{8 a^{2} f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} c^{2}}{16 a^{2} f}-\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} d^{2}}{16 a^{2} f}\) \(132\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f/a^2*((1/8*I*d^2-1/8*I*c^2-1/4*c*d)*ln(tan(f*x+e)-I)-1/2*(-c*d+1/2*I*c^2-1/2*I*d^2)/(tan(f*x+e)-I)^2-(1/2*I
*c*d-1/4*c^2-3/4*d^2)/(tan(f*x+e)-I)-1/8*I*(2*I*c*d-c^2+d^2)*ln(tan(f*x+e)+I))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 0.73, size = 83, normalized size = 0.91 \begin {gather*} \frac {{\left (4 \, {\left (c^{2} - 2 i \, c d - d^{2}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{2} - 2 \, c d - i \, d^{2} - 4 \, {\left (-i \, c^{2} - i \, d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/16*(4*(c^2 - 2*I*c*d - d^2)*f*x*e^(4*I*f*x + 4*I*e) + I*c^2 - 2*c*d - I*d^2 - 4*(-I*c^2 - I*d^2)*e^(2*I*f*x
+ 2*I*e))*e^(-4*I*f*x - 4*I*e)/(a^2*f)

________________________________________________________________________________________

Sympy [A]
time = 0.24, size = 258, normalized size = 2.84 \begin {gather*} \begin {cases} \frac {\left (\left (16 i a^{2} c^{2} f e^{4 i e} + 16 i a^{2} d^{2} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{2} f e^{2 i e} - 8 a^{2} c d f e^{2 i e} - 4 i a^{2} d^{2} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{2} - 2 i c d - d^{2}}{4 a^{2}} + \frac {\left (c^{2} e^{4 i e} + 2 c^{2} e^{2 i e} + c^{2} - 2 i c d e^{4 i e} + 2 i c d - d^{2} e^{4 i e} + 2 d^{2} e^{2 i e} - d^{2}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {x \left (c^{2} - 2 i c d - d^{2}\right )}{4 a^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**2/(a+I*a*tan(f*x+e))**2,x)

[Out]

Piecewise((((16*I*a**2*c**2*f*exp(4*I*e) + 16*I*a**2*d**2*f*exp(4*I*e))*exp(-2*I*f*x) + (4*I*a**2*c**2*f*exp(2
*I*e) - 8*a**2*c*d*f*exp(2*I*e) - 4*I*a**2*d**2*f*exp(2*I*e))*exp(-4*I*f*x))*exp(-6*I*e)/(64*a**4*f**2), Ne(a*
*4*f**2*exp(6*I*e), 0)), (x*(-(c**2 - 2*I*c*d - d**2)/(4*a**2) + (c**2*exp(4*I*e) + 2*c**2*exp(2*I*e) + c**2 -
 2*I*c*d*exp(4*I*e) + 2*I*c*d - d**2*exp(4*I*e) + 2*d**2*exp(2*I*e) - d**2)*exp(-4*I*e)/(4*a**2)), True)) + x*
(c**2 - 2*I*c*d - d**2)/(4*a**2)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 176 vs. \(2 (73) = 146\).
time = 0.64, size = 176, normalized size = 1.93 \begin {gather*} -\frac {\frac {2 \, {\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} \log \left (-i \, \tan \left (f x + e\right ) + 1\right )}{a^{2}} + \frac {2 \, {\left (i \, c^{2} + 2 \, c d - i \, d^{2}\right )} \log \left (-i \, \tan \left (f x + e\right ) - 1\right )}{a^{2}} + \frac {-3 i \, c^{2} \tan \left (f x + e\right )^{2} - 6 \, c d \tan \left (f x + e\right )^{2} + 3 i \, d^{2} \tan \left (f x + e\right )^{2} - 10 \, c^{2} \tan \left (f x + e\right ) + 20 i \, c d \tan \left (f x + e\right ) - 6 \, d^{2} \tan \left (f x + e\right ) + 11 i \, c^{2} + 6 \, c d + 5 i \, d^{2}}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x, algorithm="giac")

[Out]

-1/16*(2*(-I*c^2 - 2*c*d + I*d^2)*log(-I*tan(f*x + e) + 1)/a^2 + 2*(I*c^2 + 2*c*d - I*d^2)*log(-I*tan(f*x + e)
 - 1)/a^2 + (-3*I*c^2*tan(f*x + e)^2 - 6*c*d*tan(f*x + e)^2 + 3*I*d^2*tan(f*x + e)^2 - 10*c^2*tan(f*x + e) + 2
0*I*c*d*tan(f*x + e) - 6*d^2*tan(f*x + e) + 11*I*c^2 + 6*c*d + 5*I*d^2)/(a^2*(tan(f*x + e) - I)^2))/f

________________________________________________________________________________________

Mupad [B]
time = 5.24, size = 93, normalized size = 1.02 \begin {gather*} -\frac {x\,{\left (d+c\,1{}\mathrm {i}\right )}^2}{4\,a^2}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {c\,d}{2\,a^2}+\frac {c^2\,1{}\mathrm {i}}{4\,a^2}+\frac {d^2\,3{}\mathrm {i}}{4\,a^2}\right )+\frac {c^2}{2\,a^2}+\frac {d^2}{2\,a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*tan(e + f*x))^2/(a + a*tan(e + f*x)*1i)^2,x)

[Out]

(tan(e + f*x)*((c^2*1i)/(4*a^2) + (d^2*3i)/(4*a^2) + (c*d)/(2*a^2)) + c^2/(2*a^2) + d^2/(2*a^2))/(f*(2*tan(e +
 f*x) + tan(e + f*x)^2*1i - 1i)) - (x*(c*1i + d)^2)/(4*a^2)

________________________________________________________________________________________